﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-09-19 03:07:30
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
Description :   Bll_OS层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_sys_DICTIONARY的摘要说明。
	/// </summary>
    public partial class   Bll_zwcl_kczbH
  	{ 
     		      
  		private readonly Dal_zwcl_kczbH dal=new  Dal_zwcl_kczbH(); 
  		public  Bll_zwcl_kczbH() 
  		{} 
  		 
  		#region  Method 
     		      
  		public bool Exists(int DjLsh) 
  		{ 
  			return dal.Exists(DjLsh); 
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public bool  Add(zwcl_kczbH_Entity model) 
  		{ 
  			return dal.Add(model); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(zwcl_kczbH_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(zwcl_kczbH_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据(字符串) 
  		/// </summary> 
  		public string UpdateStr(zwcl_kczbH_Entity model) 
  		{ 
  			return dal.UpdateStr(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(int DjLsh) 
  		{ 
  			 
  			return dal.Delete(DjLsh); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			return dal.DeleteList(lists ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public zwcl_kczbH_Entity GetModel(int DjLsh) 
  		{ 
  			 
  			return dal.GetModel(DjLsh); 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  	 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<zwcl_kczbH_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<zwcl_kczbH_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<zwcl_kczbH_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<zwcl_kczbH_Entity> modelList = new List<zwcl_kczbH_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				zwcl_kczbH_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  				model = new zwcl_kczbH_Entity();					 
  			    
			      if (dt.Rows[n]["DjLsh"] != null && dt.Rows[n]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[n]["DjLsh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjBtZdh"] != null && dt.Rows[n]["DjBtZdh"].ToString() != "")
                model.DjBtZdh = int.Parse(dt.Rows[n]["DjBtZdh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjFtZdh"] != null && dt.Rows[n]["DjFtZdh"].ToString() != "")
                model.DjFtZdh = int.Parse(dt.Rows[n]["DjFtZdh"].ToString());
			  
	        
			      if (dt.Rows[n]["DjStZdh"] != null && dt.Rows[n]["DjStZdh"].ToString() != "")
                model.DjStZdh = int.Parse(dt.Rows[n]["DjStZdh"].ToString());
			  
	        model.DjState = dt.Rows[n]["DjState"].ToString();
	        
			      if (dt.Rows[n]["DjCount"] != null && dt.Rows[n]["DjCount"].ToString() != "")
                model.DjCount = int.Parse(dt.Rows[n]["DjCount"].ToString());
			  
	        
			      if (dt.Rows[n]["yy"] != null && dt.Rows[n]["yy"].ToString() != "")
                model.yy = int.Parse(dt.Rows[n]["yy"].ToString());
			  
	        
			      if (dt.Rows[n]["mm"] != null && dt.Rows[n]["mm"].ToString() != "")
                model.mm = int.Parse(dt.Rows[n]["mm"].ToString());
			  
	        model.ckbh = dt.Rows[n]["ckbh"].ToString();
	        model.ckmc = dt.Rows[n]["ckmc"].ToString();
	        model.spbh = dt.Rows[n]["spbh"].ToString();
	        model.spmc = dt.Rows[n]["spmc"].ToString();
	        if (dt.Rows[n]["qcsl"] != null && dt.Rows[n]["qcsl"].ToString() != "")
			  model.qcsl = decimal.Parse(dt.Rows[n]["qcsl"].ToString());
			
	        if (dt.Rows[n]["qcje"] != null && dt.Rows[n]["qcje"].ToString() != "")
			  model.qcje = decimal.Parse(dt.Rows[n]["qcje"].ToString());
			
	        if (dt.Rows[n]["jssl"] != null && dt.Rows[n]["jssl"].ToString() != "")
			  model.jssl = decimal.Parse(dt.Rows[n]["jssl"].ToString());
			
	        if (dt.Rows[n]["jsje"] != null && dt.Rows[n]["jsje"].ToString() != "")
			  model.jsje = decimal.Parse(dt.Rows[n]["jsje"].ToString());
			
	        if (dt.Rows[n]["fcsl"] != null && dt.Rows[n]["fcsl"].ToString() != "")
			  model.fcsl = decimal.Parse(dt.Rows[n]["fcsl"].ToString());
			
	        if (dt.Rows[n]["fcje"] != null && dt.Rows[n]["fcje"].ToString() != "")
			  model.fcje = decimal.Parse(dt.Rows[n]["fcje"].ToString());
			
	        if (dt.Rows[n]["tzsl"] != null && dt.Rows[n]["tzsl"].ToString() != "")
			  model.tzsl = decimal.Parse(dt.Rows[n]["tzsl"].ToString());
			
	        if (dt.Rows[n]["tzje"] != null && dt.Rows[n]["tzje"].ToString() != "")
			  model.tzje = decimal.Parse(dt.Rows[n]["tzje"].ToString());
			
	        if (dt.Rows[n]["qmsl"] != null && dt.Rows[n]["qmsl"].ToString() != "")
			  model.qmsl = decimal.Parse(dt.Rows[n]["qmsl"].ToString());
			
	        if (dt.Rows[n]["qmje"] != null && dt.Rows[n]["qmje"].ToString() != "")
			  model.qmje = decimal.Parse(dt.Rows[n]["qmje"].ToString());
			
	        if (dt.Rows[n]["cgthsl"] != null && dt.Rows[n]["cgthsl"].ToString() != "")
			  model.cgthsl = decimal.Parse(dt.Rows[n]["cgthsl"].ToString());
			
	        if (dt.Rows[n]["cgthje"] != null && dt.Rows[n]["cgthje"].ToString() != "")
			  model.cgthje = decimal.Parse(dt.Rows[n]["cgthje"].ToString());
			
	        
  				 modelList.Add(model); 
  				}
  			}
  		}
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 批量处理 
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error ) 
  		{ 
  			return dal.ExecuteSqlTran(ls,ref   error); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return dal.ExecuteSql(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			return dal.GetSingle(sql); 
  		} 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public DataTable ExecuteDt(string sql) 
  		{ 
  			return dal.ExecuteDt(sql); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
